package edu.ncu.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
    private int userId;
    private String account;
    private String uname;
    private String upwd;
    private int age;
    private String sex;
    private String description; //个人描述
    private String headPhoto;   //头像地址
    private int integral;       //积分
    private int grade;          //等级
    private int state;          //状态

    @Transient
    private List<Publish> publishes ; // 一个用户可发表多个动态
    @Transient
    private List<Photo> photos ; // 一个用户可以上传多张照片
    @Transient
    private List<User> friends ; // 一个用户可以有多个好友
    @Transient
    private int photoCounts ; // 照片数
    @Transient
    private int publishCounts ;// 动态数

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return userId == user.userId;
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId);
    }
}
